﻿//------------------------------------------------------------------------------
// <copyright file="AboutBox.cs" company="">
// Copyright (c) 2009 GPS Track Viewer development team
// http://trackviewer.codeplex.com/
// 
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
// MA 02110-1301, USA.
// </copyright>
// <author></author>
// <date>22.09.2010</date>
// <summary>Contains information about the AboutBox class.</summary>
//------------------------------------------------------------------------------

namespace TrackViewer
{
	using System;
	using System.Diagnostics;
	using System.Globalization;
	using System.Reflection;
	using System.Windows.Forms;
	
	/// <summary>
	/// The about box for the main form.
	/// </summary>
	public partial class AboutBox : Form
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="AboutBox"/> class.
		/// </summary>
		public AboutBox()
		{
			InitializeComponent();

			linkWebsite.Links[0].LinkData = linkWebsite.Text;

			string version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
			labelVersion.Text = String.Format(CultureInfo.CurrentCulture, "Version {0}", version);
		}

		/// <summary>
		/// Executed when the website link is clicked.
		/// </summary>
		/// <param name="sender">The sender.</param>
		/// <param name="e">The <see cref="System.Windows.Forms.LinkLabelLinkClickedEventArgs"/> instance containing the event data.</param>
		private void LinkWebsiteClicked(object sender, LinkLabelLinkClickedEventArgs e)
		{
			// Specify that the link was visited.
			e.Link.Visited = true;

			string target = e.Link.LinkData as string;

			// Navigate to a URL.
			if (target != null)
			{
				Process.Start(target);
			}
		}
	}
}
